module PrismBreak {

    export class ConfigItem {

        public RegionId: string;

        public ViewModelPath: string;

        public ViewModelType: string;

        public Markup: string;

        public ViewId: string;

        public Visible: boolean;

        constructor() {

        }


        public JsonToConfigItem(json: Object): ConfigItem {


            if (json.hasOwnProperty("regionId")) {
                this.RegionId = json["regionId"];
            }

            if (json.hasOwnProperty("viewId")) {
                this.ViewId = json["viewId"];
            }

            if (json.hasOwnProperty("viewModelPath")) {
                this.ViewModelPath = json["viewModelPath"];
            }

            if (json.hasOwnProperty("viewModelType")) {
                this.ViewModelType = json["viewModelType"];
            }

            if (json.hasOwnProperty("markup")) {
                this.Markup = json["markup"];
            }         


            if (json.hasOwnProperty("visible")) {
                this.Visible = json["visible"];
            }

            return this;
        }

        public ReturnViewModelTypeArray(): string[] {
            if (this.ViewModelType) {
                return this.ViewModelType.split("/");
            }
            else {
                throw new Error("Config item" + JSON.stringify(this) + " caused an error: invalid viewModelType");
            }
        }

    }



}